#include <stdio.h>
#include "aimage.h"
#include "accumulate.h"
#include "aimage_utils.h"
#include "aimage_dcraw.h"
#include "aimage_ppm.h"
#include <assert.h>
#include <stdlib.h>

int main( int argc, char *argv[] )
{
	int i;
	AIMAGE frame;
	AIMAGE dark;
	AIMAGE hotmap;

	AIMAGE_PPM_UTILS::load( hotmap, "hotmap.ppm" );
	AIMAGE_PPM_UTILS::load( dark, "dark.ppm" );

	for ( i = 1; i < argc; ++i )
	{
		fprintf(stderr,"Read and accumulate %s\n", argv[i] );
		AIMAGE_DCRAW_UTILS::load( frame, argv[ i ] );
		
		AIU::correct_for_hotmap( frame, hotmap );
		AIU::diff( frame, dark );
		float noise = AIU::get_noise( frame );
		printf("Stddev from dark frame %g\n", noise );
	}
}

